from fastapi import FastAPI
from typing import Optional
import uvicorn
app = FastAPI()


@app.get("/items/{item_id}")
async def read_item(item_id: str, q: Optional[str] = None):
    if q:
        return {"item_id": item_id, "q": q}
    return {"item_id": item_id}


if __name__ == "__main__":
    uvicorn.run('fast_api:app', port=8000, reload=True)
